package org.ielts.domain.report;

import java.text.NumberFormat;

import org.ielts.domain.security.User;

public class TeacherLessonReport {

	private User teacher;

	public User getTeacher() {
		return teacher;
	}

	public void setTeacher(User teacher) {
		this.teacher = teacher;
	}

	public long getCanceled() {
		return canceled;
	}

	public void setCanceled(long canceled) {
		this.canceled = canceled;
	}

	public long getSum() {
		return sum;
	}

	public void setSum(long sum) {
		this.sum = sum;
	}

	long canceled;
	long sum;

	public String getRate() {
		if (sum == 0) {
			return "0";
		}

		double d = (double) canceled / sum;

		NumberFormat defaultFormat = NumberFormat.getPercentInstance();
		defaultFormat.setMinimumFractionDigits(2);

		return defaultFormat.format(d);
	}
}
